import request from '@/utils/request'

import type {
    getCarListParams,
    addCarParams,
    getCarInfoParams
} from '@/types'

// 查询车辆列表
export const getCarList = (data: getCarListParams) => {
    return request({
        url: '/app/vehicle/getDriverVehiclePage',
        method: 'post',
        data
    })
}

// 查询车辆类型
export const getCarType = () => {
    return request({
        url: '/dict/getCarType',
        method: 'post'
    })
}

// 查询车辆颜色
// 导出一个函数，用于获取汽车颜色
export const getCarColor = () => {
    return request({
        url: '/dict/getCarColor',
        method: 'post'
    })
}

// 查询车辆能源类型
export const getCarEnergy = () => {
    return request({
        url: '/dict/getCarEnergyType',
        method: 'post'
    })
}

// 添加车辆
export const addCar = (data: addCarParams) => {
    return request({
        url: '/app/vehicle/saveVehicle',
        method: 'post',
        data
    })
}

// 获取车辆信息
export const getCarInfo = (data: getCarInfoParams) => {
    return request({
        url: '/app/vehicle/getVehicle',
        method: 'post',
        data
    })
}

// 修改车辆
export const editCar = (data: any) => {
    return request({
        url: '/app/vehicle/updateVehicle',
        method: 'post',
        data
    })
}